import request from "../utils/request"

// axios.get()  axios.post() 默认返回一个Promise实例, 等请求有结果之后 =>Promise实例会变为fulfilled状态,实例中存储的数据是 response(相应的配置对象)


// 此写法默认值处理请求成功时的操作  esponse.status != 200的情况没有处理
// export const adminLoginAPI = (data) => request.post("/admin/login",data,{}).then(response=>response.data);

// export const adminLoginAPI = (data) => request.post("/admin/login",data,{}).then(response=>{
//     if(response.status == 200){
//         return response.data;
//     }else{ // 其他情况 => 
//         var err = new Error()
//         return Promise.reject(err);
//     }
// });


export const adminLoginAPI = (data) => request.post("/admin/login",data,{})
export const addAdminAPI = (data) => request.post("/admin/add",data,{})
export const delAdminAPI = (data) => request.post("/admin/delete",data,{})

export const getAdminListAPI = (params) => request.get("/admin/list",{params})




